package cn.edu.sdjzu.xg.bysj.domain.authority;

import lombok.*;

import java.io.Serializable;
import java.util.Collection;

@ToString
@Setter
@Getter

public final class Role implements Comparable<Role>, Serializable {
    private Integer id;
    private String no;
    private String description;
    private Collection<Resource> resources;

    public Role() {

    }

    public Role(String description, Collection<Resource> resources) {
        this.description = description;
        this.resources = resources;
    }

    public Role(Integer id, String description, Collection<Resource> resources) {
        this(description, resources);
        this.id = id;
    }

    public Role(Integer id, String description, String no, Collection<Resource> resources) {
        this(description, resources);
        this.id = id;
        this.no = no;
    }

    public Role(int id, String description, String no) {
        this.id = id;
        this.description = description;
        this.no = no;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Collection<Resource> getresources() {
        return resources;
    }

    public void setresources(Collection<Resource> resources) {
        this.resources = resources;
    }

    @Override
    public String toString() {
        return "Role{" +
                "id=" + id +
                ", description='" + description + '\'' +
                ", resources=" + resources +
                '}';
    }

    @Override
    public int compareTo(Role o) {
        // TODO Auto-generated method stub
        return this.id - o.id;
    }


}